#include <stdio.h>
#include "apilib.h"

void HariMain(void)
{
    char *buf, s[12];
    int win, timer, sec = 0, min = 0, hou = 0;
    api_initmalloc();
    buf = api_malloc(150 *50);
    win = api_win_create(buf, 150, 50, -1, "noodel");
    timer = api_timer_alloc();
    api_timer_init(timer, 128);
    for (;;)
    {
        sprintf(s, "%5d:%02d:%02d", hou, min, sec);
        api_win_boxfil(win, 28, 27, 115, 41, 7);
        api_win_putstr(win, 28, 27, 0, 11, s);

        api_timer_set(timer, 100);  //1 sec
        if (api_getkey(1) != 128)
            break;
        sec++;
        if (sec == 60)
        {
            sec = 0;
            min++;
            if (min == 60)
            {
                min = 0;
                hou++;
            }
        }
    }
    api_exit();
}
